<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <!--设定屏幕比例-->
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>电脑网页支付测试</title>
    <!--引入vant样式文件-->
    <link rel="stylesheet" href="css/vant.css"/>
</head>
<body>
<div id="zfb">
    <van-notice-bar
            left-icon="volume-o"
            text="测试用的订单号不可以重复使用！！！"
    ></van-notice-bar>
    <van-form @submit="onSubmit">
        <van-field
                v-model="shopName"
                name="shopName"
                label="商户名称"
                placeholder="商户名称"
                :rules="[{ required: true, message: '请填写商户名称' }]"
        ></van-field>
        <van-field
                v-model="orderNo"
                name="orderNo"
                label="订单编号"
                placeholder="订单编号"
                :rules="[{ required: true, message: '请填写订单编号' }]"
        ></van-field>
        <van-field
                v-model="totalPrice"
                name="totalPrice"
                label="订单价格"
                placeholder="订单价格"
                :rules="[{ required: true, message: '请填写订单价格' }]"
        ></van-field>
        <van-field
                v-model="returnUrl"
                name="returnUrl"
                label="支付成功返回地址"
                placeholder="支付成功返回地址"
                :rules="[{ required: true, message: '请填写支付成功返回数据地址' }]"
        ></van-field>
        <div style="margin: 16px;">
            <van-button round block type="info" native-type="submit">
                提交
            </van-button>
        </div>
    </van-form>
</div>
</body>
<!--引入jquery.js-->
<script src="js/jquery-3.3.1.js"></script>
<!--引入vue.js-->
<script src="js/vue.js"></script>
<!--引入vant.js-->
<script src="js/vant.min.js"></script>
<script>
    new Vue({
        el: '#zfb',
        data: {
            shopName: '沙箱测试-AirZhang',
            orderNo: '123456789',
            totalPrice:'0.01',
            returnUrl:'http://localhost:8866/zfb/returnPayPage'
        },
        methods: {
            onSubmit() {
                $.post(
                    "/zfb/payPage",
                    {
                        shopName: this.shopName,
                        orderNo: this.orderNo,
                        totalPrice:this.totalPrice,
                        returnUrl:this.returnUrl
                    },function (rs) {
                        document.write(rs);
                    }
                )
            }
        }
    });
</script>
</html>